package scu.maqiang.matlabcases;

import scu.maqiang.mesh.Mesh3T4;
import scu.maqiang.mesh.MeshFormat;
import scu.maqiang.mesh.ScalarFunc;
import scu.maqiang.numeric.MVO;

public class MultilayerShpere {

	public static void main(String[] args) {
		String meshFile = "D:\\MatlabCode\\PDETool\\MultilayerSphere.matmsh";
		Mesh3T4 mesh3D = new Mesh3T4().readMesh(meshFile, MeshFormat.matMsh);
		mesh3D.toTecplot("matlabMeshes\\MultilayerSphere.dat");
		ScalarFunc outBdFunc = (xyz, label, param) -> Math.abs(MVO.L2Norm(xyz) - 6.0) < 0.05?1.0:-1.0;
		ScalarFunc innerBdFunc = (xyz, label, param) -> Math.abs(MVO.L2Norm(xyz) - 1.0) < 0.05?1.0:-1.0;
		int outBdLabel = 4, innerBdLabel = 1;
		mesh3D.setBoundaryLabel(outBdFunc, null, outBdLabel);
		mesh3D.setBoundaryLabel(innerBdFunc, null, innerBdLabel);
		mesh3D.saveMesh_mesh("MeshFile\\MultilayerShpere.mesh");
	}
}
